home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 11.5 KB | 311 lines | [TEXT/MPS ] |
- /*
- File: HIEditText.idl
-
- Contains: IDL interface for the HIEditText class
-
- Version: Technology: 8.0
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1995-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
- */
-
-
- #ifndef __TBEDITTEXT_IDL__
- #define __TBEDITTEXT_IDL__
-
- #include <Types.idl>
- #include <TextEngineSystem.idl>
-
- #include <TextEngineTypes.idl>
- #include <HIPanels.idl>
-
- interface HIEditText : HIPanel {
-
-
- // ======================================================
- // Initialization
- // ======================================================
- OSStatus InitEditTextPanel (in ::RefLabel identifier, in HIWindow window,
- in Rect bounds,in TextEngineID textEngine , in TextEngineOptions textEngineOptions );
-
-
- OSStatus GetTextEngine(out TSystemTextEngine theEngine);
- // ======================================================
- // Attribute Getter/Setter
- // ======================================================
- boolean IsTextReadOnly() ;
-
- OSStatus MakeTextReadOnly(in boolean readOnly);
-
- //valid only when text is read only
- OSStatus EnableSelection(in boolean enableIt);
-
- //always true if Text is not read only
- boolean IsTextSelectable() ;
-
- boolean IsTextMaskable() ;
-
-
- // ======================================================
- // Text Bounds and margins
- // ======================================================
- // setting bounds where the text flows
- // the value kTextUnbounded means that text has no fixed boundary
- //line breaks only on CR. (variable wifth or height) .
- //kUseViewBounds means that the boundary of text flow is the panel bound
- OSStatus SetTextBounds( in UInt32 width, in UInt32 height );
-
- OSStatus GetTextBounds( out UInt32 width, out UInt32 height );
-
-
- //the viewRect for the text is always the panel rect unless you specify
- // margins ( offset to add to left top and remove from bottom right)
- OSStatus SetMargins( in Rect marginOffsets );
-
- OSStatus GetMargins( out Rect marginOffsets );
-
- // all routines that take index as input param assume that it is aligned on character boundaries
- //do we need to change the type from ByteOffset to CharacterOffsetInBytes ??
- // ======================================================
- // Text insertion/deletion/replacement
- // ======================================================
- OSStatus ReplaceTextByTextObject(in ByteOffset startIndex, in ByteOffset endIndex, in TextObject theText );
- // replace the specified range (inclusive) by the given TextObject
- // if the range to be deleted has unique language/region/encoding and the TextObject is mono-Run
- // with the same language/region/encoding as the deleted range than the inserted text will inherit
- // the same attribute else new style run(s) will be created with the suitable attributes
-
- //special version of RepalceTextByTextObject to replace the selected text
- OSStatus RepalceSelectionByTextObject(in TextObject theText);
-
- OSStatus DeleteText(in ByteOffset startIndex, in ByteOffset endIndex) ;
- // detete the given range of text
-
- OSStatus ExtractText( in ByteOffset startIndex, in ByteOffset endIndex ,out TextObject newTextObject );
-
- // ======================================================
- //Required attributes to be handled in each text panel
- // ======================================================
-
- OSStatus SetTextFont(in ByteOffset startIndex, in ByteOffset endIndex, in Str255 fontName) ;
-
- OSStatus SetTextSize(in ByteOffset startIndex, in ByteOffset endIndex, in UInt16 textSize ) ;
-
- OSStatus SetTextQDFace(in ByteOffset startIndex, in ByteOffset endIndex,
- in TextFontFace theQDFace,in boolean switchIt) ;
-
- OSStatus SetTextColor(in ByteOffset startIndex, in ByteOffset endIndex, in RGBColor theColor) ;
-
- OSStatus SetTextAlignment(in ByteOffset startIndex, in ByteOffset endIndex, in TextAlignment align) ;
- // all engines should support text Justification for the whole text, but range justification is optional
- //if the engine does not support selection alignement and the startIndex & endIndex do not specify the
- //whole text than an error txFeatureNotSupported will be issued.
-
-
- OSStatus GetTextFont(in ByteOffset startIndex, in ByteOffset endIndex, out Str255 fontName) ;
- //empty string if multifont
-
- OSStatus GetTextSize(in ByteOffset startIndex, in ByteOffset endIndex, out UInt16 textSize ) ;
- // 0 if multiSize
-
- OSStatus GetTextQDFace(in ByteOffset startIndex, in ByteOffset endIndex,
- out TextFontFace theQDFace) ;
- //
-
- OSStatus GetTextColor(in ByteOffset startIndex, in ByteOffset endIndex, out RGBColor theColor) ;
-
- OSStatus GetTextAlignment(in ByteOffset startIndex, in ByteOffset endIndex, out TextAlignment align) ;
-
-
- // given one attribute set it value
- //this is a low level API for getting & setting one attribute
- OSStatus SetOneTextAttribute( in ByteOffset startIndex, in ByteOffset endIndex,
- in TextAttributeTag theAttribute,
- in void* theValuePtr, in ByteCount theValueSize);
- // Caller should allocate the data size (we assume that he knows the type of the value
- //he is asking for.
- OSStatus GetOneTextAttribute( in ByteOffset startIndex, in ByteOffset endIndex,
- in TextAttributeTag theAttribute,
- in ByteCount theAvailableSize,
- out void* theValuePtr,
- out ByteCount theValueSize );
-
- // ======================================================
- // Text Drawing enable/Disable
- // ======================================================
- OSStatus EnableDrawText();
- OSStatus DisableDrawText();
- boolean IsDrawTextEnabled();
-
-
- // ======================================================
- // dirty flag manipulation
- // ======================================================
- OSStatus SetDirtyFlag();
- OSStatus ResetDirtyFlag();
- boolean IsPanelDirty();
- // ======================================================
- // selection manipulation
- // ======================================================
- OSStatus GetSelection( out ByteOffset startIndex, out ByteOffset endIndex );
-
- OSStatus SetSelection( in ByteOffset startIndex, in ByteOffset endIndex );
-
- OSStatus RevealText( in ByteOffset startIndex, in ByteOffset endIndex, in boolean revealBegin );
- // ======================================================
- // iteration routines are mapped to the engine iterators
- // so this is just a set of wrapper routines
- // They are kind of low level routines and almost all apps
- // ======================================================
- OSStatus CreateTextAttributeIterator( in ByteOffset startIndex, in ByteOffset endIndex,
- in Collection textAttributeFilterCollection,
- out TextAttributeIteratorRef iterationRef );
- // Create a Text Attribute iterator for the specified text range.
- // The application specifies the attributes of interest in a collection whose...
- // 1. 'tags' are the attribute identifiers
- // 2. 'collectionUser0Bit'of attribute if set specifies "wild card" value.
- // 3. 'data' portion is value to match during iteration (if not wild card iteration).
- // The resulting iterator will allow the application to iterate over the text range, and identify
- // portions of the text which match (in value) the attributes specified in the original collection,
- // and/or iterate over different attribute runs for those attributes for which "wild card" is specified.
- // The default iterator (nil collection) will iterate on every attribute change
-
- //caller owns the Collection
- OSStatus TextAttrIteratorGetNextRange( in TextAttributeIteratorRef iterationRef,
- out ByteOffset startIndex, out ByteOffset endIndex,
- in Collection textAttrCollection );
-
- OSStatus DisposeTextAttrIterator(in TextAttributeIteratorRef theIterator);
-
- OSStatus SetTheTextAttribute( in ByteOffset startIndex, in ByteOffset endIndex,
- in Collection textAttrCollection);
- // For every attribute in the filter collection specified, set the attributes of the text Range to
- // the values specified in the collection.
-
- OSStatus GetContinuousTextAttribute( in ByteOffset startIndex, in ByteOffset endIndex,
- in Collection textAttrCollection );
- // Return all the attributes which are continuous over the specified text range. Attributes which
- // are not continuous over the text range are not included in the collection returned.
-
-
- //======================================================
- // UI commmand
- //======================================================
-
- OSStatus EnableUICommandInPanel();
-
- OSStatus DisableUICommandInPanel();
-
- boolean IsUICommandEnabledInPanel();
-
-
- //======================================================
- // KeyBoard
- //======================================================
- OSStatus KeyboardLanguageChanged(in LocaleIdentifier theLocaleID); // what params ??
-
- //======================================================
- // Scrolling text
- //======================================================
- OSStatus ScrollText(in UInt32 dh, in UInt32 dv) ;
-
- OSStatus GetScrollTextAmount(out UInt32 dh, out UInt32 dv) ;
-
- // routine for tracking mouse down so caller can update scroll bar controls
- // when click in text occurs the routine will be called with a pointer to the TBEditTExt
- //the scrolled values and the userData specified here.
- //The scrolling of the text will be already done.
- OSStatus SetMouseDownTrackActionRoutine(in MouseDownInTextPanelTrackProcPtr theMouseTrackProcPtr, in void* userData) ;
-
- implementation {
- // ======================================================
- // Attributes
- // ======================================================
- //need getter for all and setter for non readonly
-
- passthru C_h = "#include <Types.h>"
- "#include <Collections.h>"
- "#include <Drag.h>"
- "#include <Events.h>"
- "#include <Quickdraw.h>"
- "#include <TextObjects.h>"
- "#include <TextEngineTypes.h>"
- "#include <TextEngineSystem.h>"
- "#include <TextCommon.h>"
- "#include <MixedMode.h>" ;
-
- passthru C_xh = "#include <Types.h>"
- "#include <Collections.h>"
- "#include <Drag.h>"
- "#include <Events.h>"
- "#include <Quickdraw.h>"
- "#include <TextObjects.h>"
- "#include <TextCommon.h>"
- "#include <TextEngineTypes.h>"
- "#include <TextEngineSystem.h>"
- "#include <TextCommon.h>"
- "#include <MixedMode.h>";
-
-
- releaseorder: InitEditTextPanel ,
- GetTextEngine ,
- IsTextReadOnly ,
- IsTextSelectable ,
- IsTextMaskable ,
- MakeTextReadOnly ,
- EnableSelection ,
- SetTextBounds ,
- GetTextBounds,
- SetMargins ,
- GetMargins,
- ReplaceTextByTextObject ,
- RepalceSelectionByTextObject ,
- DeleteText ,
- ExtractText ,
- SetTextFont ,
- SetTextSize ,
- SetTextQDFace ,
- SetTextColor ,
- SetTextAlignment ,
- GetTextFont ,
- GetTextSize ,
- GetTextQDFace ,
- GetTextColor ,
- GetTextAlignment ,
- SetOneTextAttribute ,
- GetOneTextAttribute ,
- EnableDrawText,
- DisableDrawText,
- IsDrawTextEnabled,
- SetDirtyFlag,
- ResetDirtyFlag,
- IsPanelDirty,
- reserved0 ,
- reserved1 ,
- reserved2 ,
- GetSelection ,
- SetSelection ,
- RevealText ,
- CreateTextAttributeIterator ,
- TextAttrIteratorGetNextRange ,
- DisposeTextAttrIterator ,
- SetTheTextAttribute ,
- GetContinuousTextAttribute ,
- EnableUICommandInPanel,
- IsUICommandEnabledInPanel,
- DisableUICommandInPanel,
- KeyboardLanguageChanged ,
- ScrollText ,
- GetScrollTextAmount,
- SetMouseDownTrackActionRoutine ;
- };
- };
-
- #endif
-